package dataDraw;

import java.awt.*;

/**
 * User: Szymon Kudzia
 * Date: 29.04.13
 * Time: 13:28
 */
public class GradientBackgroundDraw implements BackgroundDraw {
	Color startColor = Color.orange;
	Color endColor = Color.getHSBColor(24, 233, 128);

	GradientBackgroundDraw() {

	}

	GradientBackgroundDraw(Color start, Color end) {
		startColor = start;
		endColor = end;
	}


	@Override
	public void draw(Graphics graphics, int width, int height) {
		Graphics2D g2d = (Graphics2D)graphics;
		GradientPaint gp = new GradientPaint(0, 0, startColor,
				width, height, endColor);

		Paint p = g2d.getPaint();
		g2d.setPaint(gp);

		g2d.fillRect(0, 0, width, height);

		g2d.setPaint(p);
	}
}
